package com.hmo.appshop.mamager.dto.user;

import com.hmo.appshop.mamager.bean.User;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * 用户详细信息，用来认证使用
 */
public class UserDetails implements org.springframework.security.core.userdetails.UserDetails {

    User user;

    public UserDetails(User user) {
        this.user = user;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        //权限
        return null;
    }

    @Override
    public String getPassword() {
        return user.getPassword();
    }

    @Override
    public String getUsername() {
        return user.getUsername();
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
